const UserController = require('../controller/user.js');
const GoodController = require('../controller/good.js');
const Router = require('koa-router');
const convert = require('koa-convert')
const childRouter = new Router();

//checkToken作为中间件存在
const checkToken = require('../token/checkToken.js');

childRouter.post('/login', UserController.Login);
childRouter.post('/register', UserController.Reg);

//需要先检查权限的路由
childRouter.get('/user', checkToken, UserController.GetAllUsers);
childRouter.post('/delUser', checkToken, UserController.DelUser);

//商品
childRouter.post('/addgoodtype', GoodController.addgtype);
childRouter.post('/getgoodtype', GoodController.getgoodtypes);
childRouter.post('/addgood', GoodController.addgood);
childRouter.post('/upload', GoodController.upload);
childRouter.post('/getallgoods', GoodController.getallgoods);
childRouter.post('/getgoodinfo', GoodController.getgoodinfo);

module.exports = childRouter;